package com.kd.common;

import lombok.Data;
import java.util.List;

@Data
public class PageResult<T,C> {
    private List<T> data;
    private C nextCursor; // 下一页的游标值
    private Boolean hasNext;    // 是否有下一页
    private Integer limit;      // 每页数量

    public PageResult(List<T> data, C nextCursor, Boolean hasNext, Integer limit) {
        this.data = data;
        this.nextCursor = nextCursor;
        this.hasNext = hasNext;
        this.limit = limit;
    }



    public static <T,C>PageResult<T,C> of(List<T> data, C nextCursor, Boolean hasNext, Integer limit) {
        return new PageResult<>(data, nextCursor, hasNext, limit);
    }



}